<?php
/**
 * Ecga Ajax控制器
 *
 * PHP version 5
 *
 * @package   Ecga
 * @author    Fengming Sun <sunfengming@ec3s.com>
 * @copyright 2012 Xingchangxinda Inc.
 * @version   SVN: $Id$
 */
namespace Project\Apps\Ecga\Controllers;

use \Project\Apps\Ecga\Controllers\Abstraction\EcgaController;
use \Project\Apps\Ecga\Library\Visitor;
use \Framework\System\Helper\HttpResponse;
use \Framework\System\Abstractions\PassportException;

/**
 * Ecga Ajax控制器
 *
 * PHP version 5
 *
 * @package   Ecga
 * @author    Fengming Sun <sunfengming@ec3s.com>
 * @copyright 2012 Xingchangxinda Inc.
 * @version   Release: <0.1>
 **/
class Ajax extends EcgaController
{
    /**
     * 登录页不需要验证
     *
     * @param string $act 动作
     *
     * @author Garbin
     * @return void
     */
    public static function validate($act)
    {
        return true;
    }

    /**
     * 获取项目采集批次信息
     * 
     * @param HttpRequest $request Http请求
     * 
     * @return void
     */
    public static function getBatch($request)
    {
        $projectModel = model('Projects');
        $projectId = $request->get('projectId', 'int');

        $project = $projectModel->get($projectId);

        if (!$project) {
            return ;
        }

        $batch = explode(',', $project->batchConfig);

        echo json_encode($batch);
    }
}

